package dao;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import vo.DepartmentVO;
import vo.MemberFloorVO;
import vo.MemberVO;
import vo.TodayYearVO;

@Repository
public class MemberDaoImpl implements MemberDao {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<MemberFloorVO> getmonthstep(String mid) {
		return sqlSessionTemplate.selectList("member.getmonthstep", mid);
	}

	@Override
	public MemberVO loginRow(MemberVO mvo) {
		MemberVO result=null;
		System.out.println(mvo);
		result = sqlSessionTemplate.selectOne("login",mvo); 
		return result;
	}

	@Override
	public int registerRow(MemberVO mvo) {
		return sqlSessionTemplate.insert("register", mvo);
	}

	@Override
	public List<MemberVO> getuserInfo() {
		List<MemberVO> mAry = sqlSessionTemplate.selectList("member.getuserInfo");
		return mAry;
	}

	@Override
	public List<DepartmentVO> getdeptInfo() {
		List<DepartmentVO> dAry = sqlSessionTemplate.selectList("member.getdeptInfo");
		return dAry;
	}

	@Override
	public TodayYearVO gettodaystep(String mid) {
		TodayYearVO todayYear = sqlSessionTemplate.selectOne("member.gettodaystep", mid);
		return todayYear;
	}

	@Override
	public TodayYearVO getyearstep(String mid) {
		TodayYearVO todayYear = sqlSessionTemplate.selectOne("member.getyearstep", mid);
		return todayYear;
	}

	@Override
	public int getTemperature(String mid) {
		return sqlSessionTemplate.selectOne("member.getTemperature", mid);
	}

	@Override
	public MemberVO getProfile(MemberVO mvo) {
		return sqlSessionTemplate.selectOne("getProfile", mvo);
	}

	@Override
	public int updateProfile(MemberVO mvo) {
		return sqlSessionTemplate.update("updateProfile", mvo);
	}

}
